%dXt = sigma(t)dt 
%sigma(t)=OU process with a=1 b=1 m=1 and sigma(0)=1
clear all
% index J for X
betaK=30; betas=[zeros(1,betaK);eye(betaK)];
% time T
T = 1/2;
% time mesh 
num=50; tspan = linspace(0,T,num+1);
%sigma
s=sigmahandle;
%options = odeset('AbsTol',1e-12,'RelTol',1e-6);
options = [];
row=size(betas,1); X0=zeros(row,1); sig0=1; a=1;b=1;m=1;
% solver of X
disp('solving X')
tic
[time,X] = ode45(@randucoudt,tspan,X0,options,T,a,b,m,betaK,s,sig0);
toc
varitest(time,X.*X,T,'uncorrelated','oudt',num)